﻿IF object_id(N'dbo.TabMailGroup', 'U') IS NULL
BEGIN
    CREATE TABLE [dbo].[TabMailGroup] (
        [MailGroupID]   numeric(18,0) NOT NULL identity(1, 1),
        [UserID]        numeric(18,0) NOT NULL,
        [MailGroupName] nvarchar(20)  COLLATE Chinese_PRC_CI_AS NOT NULL,

        CONSTRAINT [PK_TabMailGroup] PRIMARY KEY CLUSTERED ([MailGroupID] asc),
        CONSTRAINT [FK_TabMailGroup_TabAccountIndex] FOREIGN KEY ([UserID]) REFERENCES [dbo].[TabAccountIndex] ([UserID]) ON DELETE CASCADE ON UPDATE CASCADE
    );
END
GO
